package com.binance.notification.verifier;

import org.springframework.stereotype.Component;

import com.binance.master.validator.internal.constraintvalidators.iv.IVerifier;
import com.binance.notification.api.push.notification.MultipleNotificationPacket;

@Component
public class PushMessagePacketVerifier implements IVerifier<MultipleNotificationPacket> {

    @Override
    public boolean valid(MultipleNotificationPacket packet, ValidResult result) {
        if (packet.getAppMessage() == null && packet.getAndroidMessage() == null && packet.getIosMessage() == null
                && packet.getPcMessage() == null && packet.getWebMessage() == null) {
            result.addError("App消息、Android消息、Ios消息、PC消息、Web消息不能全部为空！");
        }
        return result.isEmpty();
    }

}
